import api from '@/api';

/**
 * 上传接口
 */
export const uploadPost = (data: any) => {
  return api.post('/medinstrument/site/uploadSingleFile', data, 'file');
};

/**
 * 分类标签数据
 */
export const categoryGet = () => {
  return api.get('/medinstrument/site/getAllGoodsCategory');
};

/**
 * 加入购物车
 */
export const addCartPost = (data: any) => {
  return api.post('/medinstrument/site/cart/addCart', data);
};

/**
 * 立即购买
 */
export const purchasePost = (data: any) => {
  return api.post('/medinstrument/site/cart/purchase', data);
};

/**
 * 提交订单
 */
export const submitOrderPost = (data: any) => {
  return api.post('/medinstrument/site/order/submitOrder', data);
};

/**
 * 个人信息 地址接口 (注意：customerShippingDetailList defaultFlag 为 YES 是默认地址)
 */
export const informationGet = () => {
  return api.get('/medinstrument/site/customer/information');
};

/**
 * 搜索
 */
export const searchPost = (data: any) => {
  return api.post('/medinstrument/site/search', {
    keyword: data.keyword,
    pageNum: data.page,
    pageSize: data.limit,
  });
};
